package com.ghn.cocknovel.ui.activity.Information.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.example.basemodel.base.BaseViewModel
import com.ghn.cocknovel.net.DataService
import com.ghn.cocknovel.ui.activity.main.vm.MainViewModel
import com.kt.NetworkModel.bean.QuickMessageBean
import com.kt.NetworkModel.bean.TransitArriveStartingPointBean
import com.kt.NetworkModel.net.CallBack
import com.kt.NetworkModel.net.RxUtils

/**
 * @author 浩楠
 *
 * @date 2023/10/11-14:29.
 *
 *      _              _           _     _   ____  _             _ _
 *     / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
 *    / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
 *   / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
 *  /_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
 * @Description: TODO
 */
open class InformationViewMldel (application: Application) : BaseViewModel(application) {
    companion object {
        val TAG: String? = MainViewModel::class.simpleName
    }
    val message = MutableLiveData<QuickMessageBean?>()
    val UpdateTransitDriverInfo=MutableLiveData<TransitArriveStartingPointBean?>()
    /**
     * 获取司机的个人信息接口
     */
    open fun getmessage() {
        DataService.quickMessage().compose(RxUtils.mainSync())
            .subscribe(object : CallBack<QuickMessageBean>() {
                override fun onResult(result: QuickMessageBean?) {
                    result?.also {
                        message.value = it
                    }
                }
            })
    }
    /**
     * 更新司机的个人信息接口
     */
    open fun driverUpdateTransitDriverInfo(driverName:String,driverAvatar:String,driverGender:Int,driverBirth:String,accountName:String,
                                           driverNumber:String,organizationName:String,entryTime:String,drivingAge:Int,provinceId:String,
                                           provinceName:String,cityId:String,cityName:String,areaId:String,areaName:String) {
        DataService.driverUpdateTransitDriverInfo(driverName,driverAvatar,driverGender,driverBirth,accountName,
            driverNumber,organizationName,entryTime,drivingAge,provinceId,
            provinceName,cityId,cityName,areaId,areaName).compose(RxUtils.mainSync())
            .subscribe(object : CallBack<TransitArriveStartingPointBean>() {
                override fun onResult(result: TransitArriveStartingPointBean?) {
                    result?.also {
                        UpdateTransitDriverInfo.value = it
                    }
                }
            })
    }
}